/*
 * @Description: 登记 - 电子文件移交归档相关接口
 * @Author: Rfan
 * @Date: 2022-11-23 11:27:41
 * @LastEditTime: 2022-11-23 18:35:23
 */

import request from '@/utils/request';
import { Key } from 'react';
import { IPageQuery } from '@/interfaces/global';

export interface IRegArchivingListParams {
  archiveTypeId?: number;
  archiveTypeName?: string;
  archivingMode?: string;
  archivingTime?: string;
  archivingUnit?: string;
  category?: string;
  createTime?: string;
  dataSize?: number;
  detectionJobId?: number;
  detectionResult?: number;
  duration?: number;
  fileCount?: number;
  folderCount?: number;
  fondsId?: number;
  fondsName?: string;
  fondsNo?: string;
  id?: number;
  operator?: number;
  operatorName?: string;
  operatorTime?: string;
  pageCount?: number;
  registrant?: string;
  registrationTime?: string;
  remark?: string;
  year?: string;
}

// 分页查询电子文件移交归档登记列表
export function fetchRegArchivingListByPage(data: IPageQuery<IRegArchivingListParams>) {
  return request({
    url: `/register-archiving/page`,
    method: 'post',
    data
  });
}

export interface IAddRegArchivingParams {
  archiveTypeId: number;
  archivingMode: string;
  archivingTime: string;
  archivingUnit: string;
  category: string;
  dataSize: number;
  detectionJobId: number;
  detectionResult: number;
  duration: number;
  fileCount: number;
  folderCount: number;
  fondsId: number;
  pageCount: number;
  registrant: string;
  registrationTime: string;
  remark: string;
  year: string;
}

// 添加电子文件移交归档登记条目
export function addRegArchiving(data: IAddRegArchivingParams) {
  return request({
    url: `/register-archiving/`,
    method: 'post',
    data
  });
}

export interface IEditRegArchivingParams extends IAddRegArchivingParams {
  id: number;
}
// 编辑电子文件移交归档登记条目
export function editRegArchiving(data: IEditRegArchivingParams) {
  return request({
    url: `/register-archiving/`,
    method: 'put',
    data
  });
}

// 删除电子文件移交归档登记条目
export function deleteRegArchivingItem(id: Key) {
  return request({
    url: `/register-archiving/${id}`,
    method: 'delete'
  });
}
